﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Threading;
namespace NoiseMonitor.Test
{
    class Program
    {
        static void Main(string[] args)
        {

            StreamReader sr = new StreamReader("全国各地经纬度坐标表.txt");
            string str2 = "12";
            StreamWriter sw = new StreamWriter(str2+".txt");
            string str;
            string[] array;
            string Longitude, Latitude;
            Random random = new Random();
            while (sr.EndOfStream == false)
            {
                str = sr.ReadLine();
                array = str.Split('\t');
                Longitude = Convert.ToInt32(Convert.ToDouble(array[2]) * 1000).ToString() + "00";
                Longitude = Longitude.Insert(Longitude.Length - 5, ".");
                Latitude = Convert.ToInt32(Convert.ToDouble(array[3]) * 1000).ToString() + "00";
                Latitude = Latitude.Insert(Latitude.Length - 5, ".");
                for (int i = 0; i < random.Next(5, 10); i++)
                {
                    str = string.Format("insert into RawData201507" + str2 + "(UserId,Longitude,Latitude,Province,City,CreateTime,Decibel)values(\"7a2f44e2-830e-4d4a-953a-7855b6bf48d1\",\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"2015-07-" + str2 + " 01:30:30\",\"{4}\");", Longitude, Latitude, array[0], array[1], random.Next(30, 100));
                    sw.WriteLine(str);
                }
            }
            sw.Close();
            sr.Close();
            Console.WriteLine("jieshu");
            Console.ReadLine();
        }
    }
}
